package sc.tool.sqlgen.branchinfo.pfs.stringpro;

import java.util.List;

/**
 * 忽略头部的处理器
 * %{headEnd}{tail} -> {tail}
 */
public class OmitHeadProcessor implements StringProcessor {

    public OmitHeadProcessor(String headEnd) {
        this.headEnd = headEnd;
    }

    String headEnd;

    @Override
    public String process(String fullName, List<StringProcessor> processors) {
        int index = fullName.lastIndexOf(headEnd);
        if (index > 0) {
            return fullName.substring(index + headEnd.length());
        }
        return fullName;
    }

}
